dojo.provide("ViewEditor");
dojo.declare("ViewEditor", BaseEditor, {
	editorMarkup: "<h1>view</h1>",
	imageId: "imageContainer",
	image: null,
	
	constructor: function() {
		this._moduleName = "view"
		ctrl.registerEditor(this)
		ctrl.getEditor("view", this.setEditor);
	},	
	
	setEditor: function(result) {
		ctrl.editors.item("view").editorMarkup = result.editor;
	},
	
	getEditorMarkup: function(result) {
		return this.editorMarkup
	},	
	
	activate: function(image) {
		console.debug("view activate");
		this.image = dojo.byId("imageContainer");
		//console.debug("view activated: image = " + dojo.debugReturn(this.image));
		console.debug("view setImage: " + dojo.debugReturn(image));
		this.image.src = image.url;
		dojo.style(this.image, "height", image.height + "px");
		dojo.style(this.image, "width", image.width + "px");
		dojo.style(this.image.parentNode, "height", image.height + "px");
		dojo.style(this.image.parentNode, "width", image.width + "px");
		console.debug("view setImage finished");
	},
	
	deactivate: function() {
		
	},
	
	setValues: function(values) {
		console.debug("view setValues");
	},
});

dojo.addOnLoad( function() {
	view = new ViewEditor();
});